import request from '@/config/axios'

// 文件上传 VO
export interface UploadVO {
  id: number // 文件ID
  fileName: string // 文件名
  filePath: string // 存储路径
  fileSize: number // 文件大小
  uploadTime: Date // 上传时间
}

// 文件上传 API
export const UploadApi = {
  // 查询文件上传分页
  getUploadPage: async (params: any) => {
    return await request.get({ url: `/energy/upload/page`, params })
  },

  // 查询文件上传详情
  getUpload: async (id: number) => {
    return await request.get({ url: `/energy/upload/get?id=` + id })
  },

  // 新增文件上传
  createUpload: async (data: UploadVO) => {
    return await request.post({ url: `/energy/upload/create`, data })
  },

  // 修改文件上传
  updateUpload: async (data: UploadVO) => {
    return await request.put({ url: `/energy/upload/update`, data })
  },

  // 删除文件上传
  deleteUpload: async (id: number) => {
    return await request.delete({ url: `/energy/upload/delete?id=` + id })
  },

  // 导出文件上传 Excel
  exportUpload: async (params) => {
    return await request.download({ url: `/energy/upload/export-excel`, params })
  },
}